class TencentController < ApplicationController
  def index
    result = Account.access_tencent(params[:code])
    if result[0]
      if result[1] == "admin"
        redirect_to '/' and return # /admin
      else
        session[:current_user] = result[1]
        cookies[:flowy_token] = result[1]
        redirect_to '/' and return
      end
    else
      render :text => result[1]
    end
  end
end